<template lang="html">
    <div class="main-page" id="store-page">
      <nav-bar :title="title"  @goBack="onClickLeft"/>
      <div class="guide">
        <div class="guide_top">
          <p>我是等你远行归来的斑驳灯影</p>
          <p>是你清晨醒来温度恰好的柔软被衿</p>
          <p>是厚重细腻残留阳光味道的纯棉毛巾</p>
          <p>是厨房里炖汤锅散发的热气氤氲</p>
          <p>... ...</p>
          <p>我是美家美货</p>
          <p>我用精选的上千款家居好物</p>
          <p>陪伴你每一程千山万水</p>
          <p>和每一个清晨黄昏</p>
        </div>
        <div class="guide_top_title">
          <img src="../../assets/image/activity/guide/guide_top.png" alt="">
          <div class="myself_title"></div>
        </div>
        <div class="guide_myself">
          <h3>自购省钱</h3>
          <p>美家美货超级会员</p>
          <p>购买平台上千款精品家居商品</p>
          <p>都将享受超级会员专属折扣</p>
          <p>并可获取最高达商品售价40%的返利</p>
          <p>按照每月消费1000元计算</p>
          <p>每月约可省300元</p>
          <p>每年约可省3600元！</p>
          <div class="guide_myself_two">
            <img src="../../assets/image/activity/guide/guide_two.png" alt="">
            <img src="../../assets/image/activity/guide/myself_buy_one.png" alt="">
            <img src="../../assets/image/activity/guide/myself_buy_two.png" alt="">
          </div>
          <div class="guide_myself_two_more">
            <img src="../../assets/image/activity/guide/myself_more.png" alt="">
          </div>
        </div>
        <div class="guide_share">
          <div class="guide_share_word">
            <h3>分享赚钱</h3>
            <p>美家美货超级会员</p>
            <p>可分享销售平台上千款精品家居商品</p>
            <p>当有人通过您的分享链接购买商品</p>
            <p>您将获取最高达商品售价40%的返利</p>
            <p>按照每月成功分享销售商品总额为10000元</p>
            <p>平均商品返利为售价30%计算</p>
            <p>每月约可赚3000元！</p>
          </div>
          <div class="guide_share_three_more">
            <img src="../../assets/image/activity/guide/share_three_title.png" alt="">
          </div>
          <div class="guide_share_three">
            <img src="../../assets/image/activity/guide/share_one.png" alt="">
            <img src="../../assets/image/activity/guide/share_two.png" alt="">
            <img src="../../assets/image/activity/guide/share_three.png" alt="">
          </div>
          <div class="guide_share_more">
            <img src="../../assets/image/activity/guide/share_more.png" alt="">
          </div>
        </div>
        <div class="eight_equity">
          <img src="../../assets/image/activity/guide/eight_equity.png" alt="">
        </div>
        <div class="open_vip" @click="openVip">{{is_vip ? '邀请好友' : '立即开通美家美货超级会员'}}</div>
      </div>
    </div>
</template>

<script>
import NavBar from '@/components/global/nav-bar.vue'

export default {
  components: { NavBar },
  data () {
    return {
      title: '新手指南',
      is_vip: false
    }
  },
  created () {
    // this.getProfile()
    this.getProfile()
  },
  methods: {
    onClickLeft () {
      this.$router.go(-1)
    },
    openVip () {
      let isMini = sessionStorage.getItem('isMini')
      if (isMini) {
        if (this.is_vip) {
          window.wx.miniProgram.navigateTo({ url: '/pages/activity/become_vip/become_vip' })
        } else {
          window.wx.miniProgram.navigateTo({ url: '/pages/member/open_vip/open_vip' })
        }
      } else {
        if (this.is_vip) {
          this.$router.push('/active/become_vip')
        } else {
          this.$router.push('/merber/index')
        }
      }
    },
    getProfile () {
      return new Promise((resolve, reject) => {
        this.$Axios({ url: 'profile', method: 'get' }).then((resp) => { // 请求成功
          if (resp.return_code === '0000') {
            if (resp.data.user_info && resp.data.user_info.lev_code !== 'COMMON_USER') {
              this.is_vip = true
            } else {
              this.is_vip = false
            }
          }
          resolve(resp)
        }).catch((error) => { // 请求失败
          this.$_requestInterceptor('error', error)
          reject(error)
        })
      })
    }
  }
}
</script>

<style lang="css" scoped>
</style>
